#include <stdio.h>

typedef struct ListNode{
    int value;
    struct ListNode *next;
}ListNode;

ListNode *New(){
    ListNode *node=(ListNode *)malloc(sizeof(ListNode));
    node->next=NULL;
    node->value=0;
    return node;
}

void main(){
    int N;
    int M;
    scanf("%d %d",&N,&M);
    int list[N];
    ListNode *head;
    ListNode *current=head;

    for (int i=0;i<N;i++){
        scanf("%d",&current->value);
        if (i!=(N-1)){
            current=current->next;
        }

    }
    ListNode *tail=current;

    for (int i=0;i<N-M;i++){
        scanf("%d",&list[i]);
        tail->next=New();
        tail=tail->next;
        tail->value=list[i];
    }


}
